package com.xdf.controller;

import com.xdf.service.NacosClientService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author chanchaw
 * @create 2025-08-18 13:31
 */
@RequiredArgsConstructor
@Slf4j
@RestController
@RequestMapping("/nacosClient")
public class NacosClientController {
    private final NacosClientService nacosClientService;

    @GetMapping("/serviceInstance")
    public List<ServiceInstance> getServiceInstances(@RequestParam(defaultValue = "ecomm-nacos-client") String serviceId){
        return nacosClientService.getNacosClientInfo(serviceId);
    }
}
